package org.jeecg.modules.demo.mes.entity;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * @Description: 产品表
 * @Author: jeecg-boot
 * @Date:   2023-02-28
 * @Version: V1.0
 */
@Data
@TableName("camellia_mes_product")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="camellia_mes_product对象", description="产品表")
public class CamelliaMesProduct implements Serializable {
    private static final long serialVersionUID = 1L;

	/**主键*/
	@TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    private String id;
	/**创建人*/
    @ApiModelProperty(value = "创建人")
    private String createBy;
	/**创建日期*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建日期")
    private Date createTime;
	/**更新人*/
    @ApiModelProperty(value = "更新人")
    private String updateBy;
	/**更新日期*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新日期")
    private Date updateTime;
	/**产品名称*/
	@Excel(name = "产品名称", width = 15)
    @ApiModelProperty(value = "产品名称")
    private String name;
	/**所用物料*/
	@Excel(name = "所用物料", width = 15, dictTable = "camellia_mes_raw", dicText = "name", dicCode = "id")
	@Dict(dictTable = "camellia_mes_raw", dicText = "name", dicCode = "id")
    @ApiModelProperty(value = "所用物料")
    private String requiredMaterial;
	/**所用工艺*/
	@Excel(name = "所用工艺", width = 15, dictTable = "camellia_mes_process_craft", dicText = "craft_name", dicCode = "id")
	@Dict(dictTable = "camellia_mes_process_craft", dicText = "craft_name", dicCode = "id")
    @ApiModelProperty(value = "所用工艺")
    private String requiredCraft;
	/**产品库存（L）*/
	@Excel(name = "产品库存（L）", width = 15)
    @ApiModelProperty(value = "产品库存（L）")
    private Double stock;
	/**保质期（月）*/
	@Excel(name = "保质期（月）", width = 15)
    @ApiModelProperty(value = "保质期（月）")
    private Integer expirationDate;
	/**库存规则*/
	@Excel(name = "库存规则", width = 15)
    @ApiModelProperty(value = "库存规则")
    private String stockUnit;
	/**is_enable*/
	@Excel(name = "is_enable", width = 15)
    private transient String isEnableString;

    private byte[] isEnable;

    public byte[] getIsEnable(){
        if(isEnableString==null){
            return null;
        }
        try {
            return isEnableString.getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return null;
    }

    public String getIsEnableString(){
        if(isEnable==null || isEnable.length==0){
            return "";
        }
        try {
            return new String(isEnable,"UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return "";
    }
}
